package com.clqteam.daoimpl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.clqteam.dao.removeShsDao;
import com.clqteam.util.JDBCutil;

public class removeShsDaoImpl implements removeShsDao{

	@Override
	public int removeShsByPid(int Pid) {
		int m = 0;
		StringBuffer sql = new StringBuffer();
		sql.append(" DELETE FROM s_product");
		sql.append(" WHERE s_product.pId =?");
		Connection con = JDBCutil.getConnection();
		try {
			PreparedStatement pst = con.prepareStatement(sql.toString());
			pst.setInt(1, Pid);
			int rst = pst.executeUpdate();
			if (rst==1) {
				m = rst;
			}else {
				m=0;
			}
			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return m;
	}

}
